package com.gxa.controller.baoBiaoController;

import com.gxa.common.R;
import com.gxa.pojo.*;
import com.gxa.service.baoBiaoService.SelectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


import java.math.BigDecimal;
import java.util.ArrayList;

@RestController
@RequestMapping("/baoBiao/select")
@Api(value = "报表内查询",tags = "报表内查询API")
@RequiresPermissions(value = {"采购报表", "仓存报表","销售报表","资金报表"}, logical = Logical.OR)
public class SelectController {

    @Autowired
    private SelectService selectService;

    @GetMapping(value = "/selectGongYingShang")
    @ApiOperation(value = "供应商明细接口",notes = "接受参数，根据参数返回供应商明细信息",httpMethod = "get", response =R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "gongYingShangInfo",value = "根据此条件查询供应商信息",paramType = "query",dataType = "String",required = false),
            @ApiImplicitParam(name = "page",value = "当前页码",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "size",value = "每页显示条数",paramType = "query",dataType = "String",required = true)
    })
    public R selectGongYingShang(@RequestParam(required = false) String gongYingShangInfo,
                                 @RequestParam String page,
                                 @RequestParam String size){

        return selectService.selectGongYingShang(gongYingShangInfo,page,size);
    }

    @GetMapping(value = "/selectShangPin")
    @RequiresPermissions("商品管理")
    @ApiOperation(value = "商品明细接口",notes = "接受参数，根据参数返回商品明细信息",httpMethod = "get", response =R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "shangPinInfo",value = "根据此条件查询商品信息",paramType = "query",dataType = "String",required = false),
            @ApiImplicitParam(name = "page",value = "当前页码",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "size",value = "每页显示条数",paramType = "query",dataType = "String",required = true)
    })
    public R selectShangPin(@RequestParam(required = false) String shangPinInfo,
                            @RequestParam String page,
                            @RequestParam String size){

        return selectService.selectShangPin(shangPinInfo,page,size);
    }

    @GetMapping(value = "/selectCangKu")
    @ApiOperation(value = "仓库明细接口",notes = "接受参数，根据参数返回仓库明细信息",httpMethod = "get", response =R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "cangKuInfo",value = "根据此条件查询仓库信息",paramType = "query",dataType = "String",required = false),
            @ApiImplicitParam(name = "page",value = "当前页码",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "size",value = "每页显示条数",paramType = "query",dataType = "String",required = true)
    })
    public R selectCangKu(@RequestParam(required = false) String cangKuInfo,
                          @RequestParam String page,
                          @RequestParam String size){

        return selectService.selectCangKu(cangKuInfo,page,size);
    }

    @GetMapping(value = "/selectKeHu")
    @ApiOperation(value = "客户明细接口",notes = "接受参数，根据参数返回客户明细信息",httpMethod = "get", response =R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "keHuInfo",value = "根据此条件查询客户信息",paramType = "query",dataType = "String",required = false),
            @ApiImplicitParam(name = "page",value = "当前页码",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "size",value = "每页显示条数",paramType = "query",dataType = "String",required = true)
    })
    public R selectKeHu(@RequestParam(required = false) String keHuInfo,
                        @RequestParam String page,
                        @RequestParam String size){
        return selectService.selectKeHu(keHuInfo,page,size);
    }

    @GetMapping(value = "/selectZhiYuan")
    @ApiOperation(value = "职员明细接口",notes = "接受参数，根据参数返回职员明细信息",httpMethod = "get", response =R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "zhiYuanInfo",value = "根据此条件查询职员信息",paramType = "query",dataType = "String",required = false),
            @ApiImplicitParam(name = "page",value = "当前页码",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "size",value = "每页显示条数",paramType = "query",dataType = "String",required = true)
    })
    public R selectZhiYuan(@RequestParam(required = false) String zhiYuanInfo,
                           @RequestParam String page,
                           @RequestParam String size){

        return selectService.selectZhiYuan(zhiYuanInfo,page,size);
    }

    @GetMapping(value = "/selectZhangHu")
    @ApiOperation(value = "账户明细接口",notes = "接受参数，根据参数返回账户明细信息",httpMethod = "get", response =R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "zhangHuInfo",value = "根据此条件查询账户信息",paramType = "query",dataType = "String",required = false),
            @ApiImplicitParam(name = "page",value = "当前页码",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "size",value = "每页显示条数",paramType = "query",dataType = "String",required = true)
    })
    public R selectZhangHu(@RequestParam(required = false) String zhangHuInfo,
                           @RequestParam String page,
                           @RequestParam String size){

        return selectService.selectZhangHu(zhangHuInfo,page,size);
    }

    @GetMapping(value = "/selectKeHuLeiBie")
    @ApiOperation(value = "客户类别接口",notes = "返回客户类别信息",httpMethod = "get", response =R.class)
    public R selectKeHuLeiBie(){
        return selectService.selectKeHuLeiBie();
    }

    @GetMapping(value = "/selectGongYingShangLeiBie")
    @ApiOperation(value = "供应商类别接口",notes = "返回供应商类别信息",httpMethod = "get", response =R.class)
    public R selectGongYingShangLeiBie(){

        return selectService.selectGongYingShangLeiBie();
    }
}
